package com.daimler.itffo.tables;

import com.daimler.itffo.uvs.kern.Baumuster;
import com.daimler.itffo.uvs.kern.Code;


public class V0BRDEQTPkey implements Comparable<Object> {
	
    public static final String TYP_EQUIPM_CD_EQUIPMENT = new String("EQUIPMENT");
    public static final String TYP_EQUIPM_CD_PAINT = new String("PAINT");
    public static final String TYP_EQUIPM_CD_PAINTU = new String("PAINTU");
    public static final String TYP_EQUIPM_CD_UPHOLSTERY = new String("UPHOLSTERY");

    public static final String TYP_MANUF_FROU_CD_MBPKW = new String("0M");
    public static final String TYP_MANUF_FROU_CD_SMART = new String("0S");

    private static final String DEFAULT_LEER_STRING = new String("");


    private String typEquimCD;
    private String manufGrouCD;
    private Baumuster modelDisigna;
    protected String modelDisignaString;
    private Code equipmentCD;
    private String languageCD;
    private String fromDate;
    private String toDate;

	public int compareTo(Object o) {
		V0BRDEQTPkey pkey = (V0BRDEQTPkey) o;
		int result = 0;

		result = pkey.getEquipmentCD().compareTo(this.equipmentCD);

		if (result == 0)
			result = pkey.getTypEquimCD().compareTo(
					this.typEquimCD);

		if (result == 0)
			result = pkey.getManufGrouCD().compareTo(this.manufGrouCD);

		if (result == 0)
			result = pkey.getModelDisignaString().compareTo(this.modelDisignaString);

		if (result == 0)
			result = pkey.getLanguageCD().compareTo(this.languageCD);

		return result;
	}

    public V0BRDEQTPkey(String typEquimCD, String manufGrouCD, Baumuster modelDisigna, Code equipmentCD, String languageCD) {
        super();
        this.typEquimCD = typEquimCD;
        this.manufGrouCD = manufGrouCD;
        this.modelDisigna = modelDisigna;
        this.modelDisignaString = modelDisigna.get6DigitsBaumusterWithoutDot();
        this.equipmentCD = equipmentCD;
        this.languageCD = languageCD;
        this.fromDate = DEFAULT_LEER_STRING;
        this.toDate = DEFAULT_LEER_STRING;

    }

    public V0BRDEQTPkey(String typEquimCD, String manufGrouCD, Baumuster modelDisigna, Code equipmentCD,
    		String languageCD, String fromDate, String toDate) {
        super();
        this.typEquimCD = typEquimCD;
        this.manufGrouCD = manufGrouCD;
        this.modelDisigna = modelDisigna;
        this.modelDisignaString = modelDisigna.get6DigitsBaumusterWithoutDot();
        this.equipmentCD = equipmentCD;
        this.languageCD = languageCD;
        this.fromDate = fromDate;
        this.toDate = toDate;
    }

    public V0BRDEQTPkey(String typEquimCD, String manufGrouCD,  Code equipmentCD, String languageCD) {
        super();
        this.typEquimCD = typEquimCD;
        this.manufGrouCD = manufGrouCD;
        this.modelDisigna = new Baumuster();
        this.modelDisignaString = new String("");
        this.equipmentCD = equipmentCD;
        this.languageCD = languageCD;
        this.fromDate = DEFAULT_LEER_STRING;
        this.toDate = DEFAULT_LEER_STRING;
    }

    public Code getEquipmentCD() {
        return equipmentCD;
    }

    public String getFromDate() {
        return fromDate;
    }

    public String getLanguageCD() {
        return languageCD;
    }

    public String getManufGrouCD() {
        return manufGrouCD;
    }

    public Baumuster getModelDisigna() {
        return modelDisigna;
    }

    public String getToDate() {
        return toDate;
    }

    public String getTypEquimCD() {
        return typEquimCD;
    }

    public int hashCode() {
        final int PRIME = 31;
        int result = 1;
        result = PRIME * result + ((equipmentCD == null) ? 0 : equipmentCD.hashCode());
        result = PRIME * result + ((fromDate == null) ? 0 : fromDate.hashCode());
        result = PRIME * result + ((languageCD == null) ? 0 : languageCD.hashCode());
        result = PRIME * result + ((manufGrouCD == null) ? 0 : manufGrouCD.hashCode());
        result = PRIME * result + ((modelDisigna == null) ? 0 : modelDisigna.hashCode());
        result = PRIME * result + ((toDate == null) ? 0 : toDate.hashCode());
        result = PRIME * result + ((typEquimCD == null) ? 0 : typEquimCD.hashCode());
        return result;
    }

    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        final V0BRDEQTPkey other = (V0BRDEQTPkey) obj;
        if (equipmentCD == null) {
            if (other.equipmentCD != null)
                return false;
        } else if (!equipmentCD.equals(other.equipmentCD))
            return false;
        if (fromDate == null) {
            if (other.fromDate != null)
                return false;
        } else if (!fromDate.equals(other.fromDate))
            return false;
        if (languageCD == null) {
            if (other.languageCD != null)
                return false;
        } else if (!languageCD.equals(other.languageCD))
            return false;
        if (manufGrouCD == null) {
            if (other.manufGrouCD != null)
                return false;
        } else if (!manufGrouCD.equals(other.manufGrouCD))
            return false;
        if (modelDisigna == null) {
            if (other.modelDisigna != null)
                return false;
        } else if (!modelDisigna.equals(other.modelDisigna))
            return false;
        if (toDate == null) {
            if (other.toDate != null)
                return false;
        } else if (!toDate.equals(other.toDate))
            return false;
        if (typEquimCD == null) {
            if (other.typEquimCD != null)
                return false;
        } else if (!typEquimCD.equals(other.typEquimCD))
            return false;
        return true;
    }

    public void group() {
    	this.modelDisignaString = this.modelDisigna.getBaureihe();
    }

	public String getModelDisignaString() {
		return modelDisignaString;
	}



}